<script>
import axios from "axios";

export  default  {
    data() {
        return {
            username: '',
            password: ''
        }
    },
    methods: {
        send() {
            axios({
                url: '/wx/user/login',
                method: 'POST',
                data: {
                    username: this.username,
                    password: this.password
                }
            }).then(res => {
                console.log(res)
                if (res.data.code === 1) {
                    // 页面跳转 作用类似于 <router-link to="/other">登录</router-link>
                    // this.$router
                    this.$router.push("/other")
                }
            })
        }
    }

}
</script>

<template>
    <input v-model="username"> <br/>

    <input v-model="password"> <br />
    <!--<router-link to="/other">登录</router-link>-->
    <button @click="send" >登录</button>
</template>

<style scoped>

</style>